﻿using System.Collections.Generic;
using ConceptsFramework.AbstractConceptElements;
using ConceptsFramework.ConceptResults;

namespace ConceptsFramework.ConceptsQueryEngine
{
    public abstract class AbstractQueryHolder
    {
        public abstract ResultSet Query(ResultSet inputSet);
        
        /// <summary>
        /// Query on a single AbstractBindableConcept
        /// </summary>
        /// <param name="concept"></param>
        /// <returns></returns>
        protected ResultSet Query(AbstractBindableConcept concept)
        {
            ResultSet intermediateSet = new ResultSet();
            intermediateSet.CurrentSet.Add(concept);
            return Query(intermediateSet);
        }

        protected ResultSet Query(params AbstractBindableConcept[] concepts)
        {
            ResultSet intermediateSet = new ResultSet();
            foreach(var concept in concepts)
                intermediateSet.CurrentSet.Add(concept);
            return Query(intermediateSet);
        }

        protected ResultSet Query(List<AbstractBindableConcept> concepts)
        {
            ResultSet intermediateSet = new ResultSet();
            foreach (var concept in concepts)
                intermediateSet.CurrentSet.Add(concept);
            return Query(intermediateSet);
        }

    }
}
